package com.cps116.friendstracker;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class PrefActivity extends PreferenceActivity{

	Context referredContext;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		addPreferencesFromResource(R.xml.prefs);
		
	}

	//create the option menu 
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.friendstracker_menu, menu);
		return true;
	}

	//switching between different views
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {                              // 
		case R.id.menuOptionProfile:
			startActivity(new Intent(this, ProfileActivity.class));  // 
			break;
		case R.id.menuOptionMap:
			startActivity(new Intent(this, FriendsFinderMapActivity.class));
			break;
		case R.id.menuOptionQuery:
			startActivity(new Intent(this, QueryActivity.class));
			break;
		case R.id.menuOptionLogOut:
			((FriendsTrackerApplication) getApplication()).logoutFacebook();
			startActivity(new Intent(this, FacebookConnect.class));
			break;
		}
		
		return true;  // 
	}

	
	
	
	
	

}
